package com.papper.common.config;

import com.papper.common.utils.tool.OrderTool;
import com.papper.common.utils.tool.StringTool;

/**
 * @author:LaJiao
 * @date 2022年04月10日
 * @time 08时16
 * @Description:本地缓存配置信息
 */
public class StorageConstants {
    public final static String SYSTEM_CODE    = "system_code";
    public final static String SYSTEM_NAME    = "system_name";
    public final static String IP_REMOTE_TYPE = "ip.remote.type";
    public final static String SUPER_USERNAME = "super_username";
    public final static String SUPER_PASSWORD = "super_password";
    public final static String SUPER_IPLIMIT  = "super_iplimit";
    public final static String AUTH_FLG       = "auth_flg";
    public final static String AUTH_MD5       = "auth_md5";
    public final static String AUTH_USERNAME  = "auth_username";
    public final static String AES_KEY        = "aes_key";
    public final static String PAGE_AES_KEY   = "page_aes_key";

    public static String SystemCode() {
        return PapperStorage.Local(SYSTEM_CODE);
    }

    public static Integer getIpRemoteType(Integer def) {
        return StringTool.parseInteger(PapperStorage.Local(IP_REMOTE_TYPE), def);
    }

    public static Integer getAuthFlg(Integer def) {
        return StringTool.parseInteger(PapperStorage.Local(AUTH_FLG), def);
    }

    public static String getAuthMd5() {
        return PapperStorage.Local(AUTH_MD5);
    }

    public static String getAesKey() {
        return OrderTool.zerofill(StringTool.cutString(PapperStorage.Local(AES_KEY), 17), 16);
    }

    public static String getPageAesKey() {
        return OrderTool.zerofill(StringTool.cutString(PapperStorage.Local(PAGE_AES_KEY), 17), 16);
    }
}
